<%--
  Created by IntelliJ IDEA.
  User: huangrulan
  Date: 2019/3/1
  Time: 10:58 AM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>阿星影院后台管理</title>
    <link rel="stylesheet" type="text/css" href="${base}/assets/css/layui/layui.css" media="all">
    <link href="${base}/larryms/css/login/base.css" rel="stylesheet" media="all">
    <link href="${base}/larryms/css/login/login.css" rel="stylesheet" media="all">
    <script src="https://hm.baidu.com/hm.js?382f81c966395258f239157654081890"></script>
    <script type="text/javascript" src="${base}/larryms/js/login/jquery.min.js"></script>
    <script type="text/javascript" src="${base}/larryms/js/login/jquery.qrcode.min.js"></script>
    <style>
        .checkDiv {
            display: inline-block;
            margin-top: 7px;
            margin-left: 10px;
        }

        #checkCodePic {
            width: 100px;
            height: 32px;
        }

        .layui-btn-normal {
            background-color: #5a76a6;
        }
    </style>
</head>
<body id="by">

<div id="iframe-wrap">
    <h1>阿星影城后台管理</h1>
    <div class="login" style="margin-top:50px;">
        <div class="header">
            <div class="switch" id="switch"><a class="switch_btn" id="switch_qlogin" href="login.page"
                                               tabindex="7">快速登录</a>
                <a class="switch_btn_focus" id="switch_login" href="javascript:void(0);" tabindex="8">快速注册</a>
                <div class="switch_bottom" id="switch_bottom"
                     style="position: absolute; width: 70px; left: 154px;"></div>
            </div>
        </div>
        <!--注册-->
        <div class="qlogin" id="qlogin" style="margin-top: 10px;">

            <div class="web_login">
                <form name="form2" id="regUser" accept-charset="utf-8" action="" method="post">
                    <input type="hidden" name="to" value="reg">
                    <input type="hidden" name="did" value="0">
                    <ul class="reg_form" id="reg-ul">
                        <li>
                            <label class="input-tips2">用户名：</label>
                            <div class="inputOuter2">
                                <input type="text" name="user" maxlength="16" class="inputstyle2">
                            </div>
                        </li>
                        <li>
                            <label class="input-tips2">密码：</label>
                            <div class="inputOuter2">
                                <input type="password" name="password" maxlength="16" class="inputstyle2">
                            </div>
                        </li>
                        <li>
                            <label class="input-tips2">确认密码：</label>
                            <div class="inputOuter2">
                                <input type="password" name="password2" maxlength="16" class="inputstyle2">
                            </div>
                        </li>
                        <li>
                            <label class="input-tips2">验证码：</label>
                            <div class="inputOuter2" style="width: 100px;">
                                <input type="texg" name="code" maxlength="16" class="inputstyle2" style="width: 110px;">
                            </div>
                            <div class="checkDiv"><img id="checkCodePic" class="aui-child" src="verify.json"></div>
                        </li>

                        <li>
                            <div style="margin-top:20px;">
                                <button class="layui-btn layui-btn-normal layui-btn-fluid"
                                        lay-submit lay-filter="register">登陆
                                </button>
                            </div>

                        </li>
                    </ul>
                </form>


            </div>


        </div>
        <!--注册end-->
    </div>

</div>

<!-- 加载js文件-->
<script type="text/javascript" src="${base}/assets/js/layui/layui.js"></script>
<script type="text/javascript">
    layui.config({
        version: "2.0.8",
        base: '${base}/larryms/',  //实际使用时，建议改成绝对路径
        identified: 'login',
        // mods: 'vip/',
        page: 'login',
        layertype: 2,
        rightMenu: true // false关闭，设置为custom时使用自定义，不使用默认menu
    }).extend({
        larry: 'js/base'
    }).use(['larry', 'form', 'layer'], function () {
        var $ = layui.$,
            larry = layui.larry, layer = layui.layer, form = layui.form;

        //提交表单
        form.on('submit(register)', function (data) {
            console.log(data.field);
            $.ajax({
                type: 'POST',
                url: '/login/register.json',
                dataType: 'json',
                data: data.field,
                async: true,
                success: function (res) {
                    layer.msg('这里是msg内容');
                    console.log(res);
                    if (res.success) {
                        layer.msg(res.data, {icon: 1, time: 1500}, function () {
                            // location.reload();
                        });
                    } else {
                        layer.msg(res.msg, {icon: 5, time: 2000}, function () {
                            // location.reload();
                        });
                    }
                }, error: function () {
                    layer.msg("请求失败，请联系开发人员", {icon: 5, time: 2000}, function () {
                        // location.reload();
                    });
                }
            });
        });

    });
</script>
</body>
</html>
